<template>
  <div class="orbit-page">
    <utilspage @select="handleSelect">
      <template #default="{ toggleOrbit }">
        <div class="config-app">
          <dragConent @click.stop @dragEnd="handleDragEnd($event,toggleOrbit)">
            <div >中心</div>
          </dragConent>
        </div>
      </template>
    </utilspage>
  </div>
</template>

<script lang="ts" setup>
import dragConent from '@/components/Dragareacomponent.vue'
import { HomePageProps } from './index'
import { useSystemStore } from '@/pinia/system'
const store = useSystemStore()
const router = useRouter()


const utilspage = defineAsyncComponent(() => import('@/components/utils.vue'))

const canIModify = ref(false)
const handleDragEnd = (type: boolean, toggleOrbit: () => void) => {
  canIModify.value = type
  if (!type) {
    toggleOrbit()
  }
}
const handleSelect = (idx: HomePageProps) => {
  console.log(idx)
  if (idx.id === 1) {
    window.electron.ipcRenderer.invoke('loginPage-window', '窗口',true)
  }else if (idx.id === 2) {
    window.electron.ipcRenderer.invoke('audio-window', '窗口')
  }else if (idx.id === 3) {

    window.electron.ipcRenderer.invoke('setting-windows', '设置窗口')
  }
}

onMounted(async () => {
  const systemInformation = await window.electron.ipcRenderer.invoke('get-system-information')
  window.electron.ipcRenderer.send('cross-window-message',{
    channel:'useSystemStore',
    data:systemInformation
  })
  let list = await window.electron.ipcRenderer.invoke('get-location-information')
  if (list.length > 0) {
    store.editstore({
      gPosition: list
    })
  }
  console.log("路由列表",router.options);
})
</script>

<style scoped lang="scss">
.orbit-page {
  height: 100vh;
  width: 100vw;
  // border: 1px solid #000;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.config-app {
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
